CXX = gcc
CXXFLAGS = -g -Wall

ALL = $(wildcard *.c)
PROGRAMS = $(wildcard *_Driver.c)
SOURCES = $(filter-out $(PROGRAMS),$(ALL))
OBJECTS = $(patsubst %.c,%.o,$(SOURCES))
EXECUTABLES = $(patsubst %.c,%,$(PROGRAMS))
LIBS = CLib.a
TESTS = 


all: $(EXECUTABLES) 


%.o: $@.h $@.c
	$(CXX) -o $@.o -c $@.c

test: $(TESTS)
	
lib: CLib.a
	
CLib.a: $(OBJECTS)
	ar rcs CLib.a $(OBJECTS)

%_Driver: CLib.a
	$(CXX) -o $@ $@.c CLib.a

clean:
	rm -f *~ *.o

distclean:
	rm -f *~ *.o $(EXECUTABLES) $(LIBS)


.PHONY: all clean
